# Contributor: Frédéric Guillot <fred@miniflux.net>
# Maintainer: Thomas J Faughnan Jr <thomas@faughnan.net>
pkgname=miniflux
pkgver=2.2.2
pkgrel=0
pkgdesc="Minimalist and opionated feed reader"
url="https://miniflux.app/"
arch="all"
license="Apache-2.0"
depends="postgresql-contrib" # for hstore extension
makedepends="go"
checkdepends="tzdata"
install="$pkgname.pre-install"
subpackages="$pkgname-openrc $pkgname-doc"
options="net"
source="$pkgname-$pkgver.tar.gz::https://github.com/miniflux/v2/archive/$pkgver.tar.gz
	miniflux.initd
	miniflux.confd
	miniflux.conf
	miniflux.logrotate
	"
pkggroups="miniflux"
builddir="$srcdir/v2-$pkgver"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make miniflux VERSION=$pkgver
}

check() {
	go test ./...
}

package() {
	install -Dm755 $pkgname "$pkgdir"/usr/bin/$pkgname

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname

	install -Dm640 -o root -g miniflux "$srcdir"/$pkgname.conf \
		"$pkgdir"/etc/$pkgname.conf
	install -Dm644 "$srcdir"/$pkgname.logrotate \
		"$pkgdir"/etc/logrotate.d/$pkgname
	install -Dm644 miniflux.1 "$pkgdir"/usr/share/man/man1/miniflux.1
}

sha512sums="
6866f59b89b4e173264444e9076208d6ad354839618af69a47e7e130602c8c5ab603daa87e715e3b9cbfdd2dc0911022df32bd9d03046e6562b38ae5d9b78981  miniflux-2.2.2.tar.gz
9314019c1ecb1d7b1420742f41ae5c7697e4a1a76ee05119c1cd524dedc1cd8b8825d0cf93976f284024eff5cf879fbd3d97c5d7f8015381ffc7f10661f8f89b  miniflux.initd
073bdaa3eaad2db14dc728ee9072b6ae01cd2265d61ac0cc61e3ed7db4b97ae1da8f83e1ce3aed038f97c6f5d31e91aa621753e8fad018d9d88def7fcab3ee16  miniflux.confd
fc0084e0d31a4ce29fc0110411dba8f9fd60c16af08a3364b3f828558981a308a5f9871908594753d868cdf9faf86f84f95e0134afdff8983da2b179ebdd24c1  miniflux.conf
f9d594df6ea267b6d1f060090d39825998a03af02751ee5af446e84c84794ae01d16617c2737f00c3af5325fb27f26aa680b4ba1747dcf16acb22dbc23477e7d  miniflux.logrotate
"
